using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using System.Collections.Generic;
using System.IO;

namespace EffortsTracker
{
    public class ScreenShot
    {
        public Image image;
        public DateTime date;

        public ScreenShot(Image image, DateTime date)
        {
            this.image = image;
            this.date = date;
        }

        public ScreenShot(byte[] imageByteArray, DateTime date)
        {
            setImageFromByteArray(imageByteArray);
            this.date = date;
        }

        public byte[] getImageAsByteArray()
        {
            MemoryStream ms = new MemoryStream();
            image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
            return ms.ToArray();
        }

        public static Image setImageFromByteArray(byte[] byteArrayIn)
        {
            MemoryStream ms = new MemoryStream(byteArrayIn);
            return Image.FromStream(ms);
        }
    }
}